import { useRoute } from "vue-router"
import { ref ,onMounted } from "vue"
import { getDetails } from "@/apis/detail.js"


export function useGoods() {

  const route = useRoute()

  // 获取商品数据
  let Goods = ref({})
  const getGoods = async () => {
    const res = await getDetails(route.params.id)
    Goods.value = res.result
    console.log(res.result)
  }


  onMounted(() => getGoods())


  return {
    Goods
  }


}
